package com.zenith.middleware.service.impl;

import com.zenith.common.result.Result;
import com.zenith.common.result.PageResult;
import com.zenith.common.constant.RedisKeyConstant;
import com.zenith.common.constant.RedisTtlConstant;
import com.zenith.middleware.feign.edu.EduServiceFeignClient;
import com.zenith.middleware.po.dto.edu.*;
import com.zenith.middleware.po.vo.edu.*;
import com.zenith.middleware.service.EduService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;
import java.util.concurrent.TimeUnit;

/**
 * 教育服务实现类
 */
@Slf4j
@Service
public class EduServiceImpl implements EduService {
    
    private final EduServiceFeignClient eduServiceFeignClient;
    
    @Autowired
    private RedisTemplate<String, Object> redisTemplate;
    
    public EduServiceImpl(EduServiceFeignClient eduServiceFeignClient) {
        this.eduServiceFeignClient = eduServiceFeignClient;
    }
    
    // =========================== 课程管理相关接口 ===========================
    
    @Override
    public Result<EduCourseVO> createCourse(EduCourseDTO dto) {
        Result<EduCourseVO> result = eduServiceFeignClient.createCourse(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            clearCourseCache();
        }
        return result;
    }

    @Override
    public Result<EduCourseVO> getCourseById(Long id) {
        // 构建缓存键
        String cacheKey = RedisKeyConstant.COURSE_DETAIL + id;
        
        // 尝试从缓存获取
        Result<EduCourseVO> cachedResult = (Result<EduCourseVO>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取课程详情数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<EduCourseVO> result = eduServiceFeignClient.getCourseById(id);
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.COURSE_INFO_TTL, TimeUnit.SECONDS);
            log.info("缓存课程详情数据: key={}", cacheKey);
        }
        
        return result;
    }

    @Override
    public Result<EduCourseVO> updateCourse(EduCourseDTO dto) {
        Result<EduCourseVO> result = eduServiceFeignClient.updateCourse(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            clearCourseCache();
        }
        return result;
    }

    @Override
    public Result<Void> deleteCourse(Long id) {
        Result<Void> result = eduServiceFeignClient.deleteCourse(id);
        // 清除相关缓存
        if (result != null) {
            clearCourseCache();
        }
        return result;
    }

    @Override
    public Result<List<EduCourseVO>> getCourseList() {
        // 构建缓存键
        String cacheKey = "courseList";
        
        // 尝试从缓存获取
        Result<List<EduCourseVO>> cachedResult = (Result<List<EduCourseVO>>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取课程列表数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<List<EduCourseVO>> result = eduServiceFeignClient.getCourseList();
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.COURSE_INFO_TTL, TimeUnit.SECONDS);
            log.info("缓存课程列表数据: key={}", cacheKey);
        }
        
        return result;
    }

    // =========================== 班级管理相关接口 ===========================

    @Override
    public Result<EduClassVO> createClass(EduClassDTO dto) {
        Result<EduClassVO> result = eduServiceFeignClient.createClass(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            clearClassCache();
        }
        return result;
    }

    @Override
    public Result<EduClassVO> getClassById(Long id) {
        // 构建缓存键
        String cacheKey = RedisKeyConstant.CLASS_DETAIL + id;
        
        // 尝试从缓存获取
        Result<EduClassVO> cachedResult = (Result<EduClassVO>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取班级详情数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<EduClassVO> result = eduServiceFeignClient.getClassById(id);
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存班级详情数据: key={}", cacheKey);
        }
        
        return result;
    }

    @Override
    public Result<EduClassVO> updateClass(EduClassDTO dto) {
        Result<EduClassVO> result = eduServiceFeignClient.updateClass(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            clearClassCache();
        }
        return result;
    }

    @Override
    public Result<Void> deleteClass(Long id) {
        Result<Void> result = eduServiceFeignClient.deleteClass(id);
        // 清除相关缓存
        if (result != null) {
            clearClassCache();
        }
        return result;
    }

    @Override
    public Result<List<EduClassVO>> getClassList() {
        // 构建缓存键
        String cacheKey = "classList";
        
        // 尝试从缓存获取
        Result<List<EduClassVO>> cachedResult = (Result<List<EduClassVO>>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取班级列表数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<List<EduClassVO>> result = eduServiceFeignClient.getClassList();
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存班级列表数据: key={}", cacheKey);
        }
        
        return result;
    }

    // =========================== 学生管理相关接口 ===========================

    @Override
    public Result<EduStudentVO> createStudent(EduStudentDTO dto) {
        Result<EduStudentVO> result = eduServiceFeignClient.createStudent(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            clearStudentCache();
        }
        return result;
    }

    @Override
    public Result<EduStudentVO> getStudentById(Long id) {
        // 构建缓存键
        String cacheKey = RedisKeyConstant.STUDENT_DETAIL + id;
        
        // 尝试从缓存获取
        Result<EduStudentVO> cachedResult = (Result<EduStudentVO>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取学生详情数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<EduStudentVO> result = eduServiceFeignClient.getStudentById(id);
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存学生详情数据: key={}", cacheKey);
        }
        
        return result;
    }

    @Override
    public Result<EduStudentVO> updateStudent(EduStudentDTO dto) {
        Result<EduStudentVO> result = eduServiceFeignClient.updateStudent(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            clearStudentCache();
        }
        return result;
    }

    @Override
    public Result<Void> deleteStudent(Long id) {
        Result<Void> result = eduServiceFeignClient.deleteStudent(id);
        // 清除相关缓存
        if (result != null) {
            clearStudentCache();
        }
        return result;
    }

    @Override
    public Result<List<EduStudentVO>> getStudentList() {
        // 构建缓存键
        String cacheKey = "studentList";
        
        // 尝试从缓存获取
        Result<List<EduStudentVO>> cachedResult = (Result<List<EduStudentVO>>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取学生列表数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<List<EduStudentVO>> result = eduServiceFeignClient.getStudentList();
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存学生列表数据: key={}", cacheKey);
        }
        
        return result;
    }

    // =========================== 教师管理相关接口 ===========================

    @Override
    public Result<EduTeacherVO> createTeacher(EduTeacherDTO dto) {
        Result<EduTeacherVO> result = eduServiceFeignClient.createTeacher(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除教师相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<EduTeacherVO> getTeacherById(Long id) {
        // 构建缓存键
        String cacheKey = "teacherById:" + id;
        
        // 尝试从缓存获取
        Result<EduTeacherVO> cachedResult = (Result<EduTeacherVO>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取教师详情数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<EduTeacherVO> result = eduServiceFeignClient.getTeacherById(id);
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存教师详情数据: key={}", cacheKey);
        }
        
        return result;
    }

    @Override
    public Result<EduTeacherVO> updateTeacher(EduTeacherDTO dto) {
        Result<EduTeacherVO> result = eduServiceFeignClient.updateTeacher(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除教师相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<Void> deleteTeacher(Long id) {
        Result<Void> result = eduServiceFeignClient.deleteTeacher(id);
        // 清除相关缓存
        if (result != null) {
            // 这里可以添加清除教师相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<List<EduTeacherVO>> getTeacherList() {
        // 构建缓存键
        String cacheKey = "teacherList";
        
        // 尝试从缓存获取
        Result<List<EduTeacherVO>> cachedResult = (Result<List<EduTeacherVO>>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取教师列表数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<List<EduTeacherVO>> result = eduServiceFeignClient.getTeacherList();
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存教师列表数据: key={}", cacheKey);
        }
        
        return result;
    }

    // =========================== 作业管理相关接口 ===========================

    @Override
    public Result<EduAssignmentVO> createAssignment(EduAssignmentDTO dto) {
        Result<EduAssignmentVO> result = eduServiceFeignClient.createAssignment(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除作业相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<EduAssignmentVO> getAssignmentById(Long id) {
        // 构建缓存键
        String cacheKey = "assignmentById:" + id;
        
        // 尝试从缓存获取
        Result<EduAssignmentVO> cachedResult = (Result<EduAssignmentVO>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取作业详情数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<EduAssignmentVO> result = eduServiceFeignClient.getAssignmentById(id);
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存作业详情数据: key={}", cacheKey);
        }
        
        return result;
    }

    @Override
    public Result<EduAssignmentVO> updateAssignment(EduAssignmentDTO dto) {
        Result<EduAssignmentVO> result = eduServiceFeignClient.updateAssignment(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除作业相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<Void> deleteAssignment(Long id) {
        Result<Void> result = eduServiceFeignClient.deleteAssignment(id);
        // 清除相关缓存
        if (result != null) {
            // 这里可以添加清除作业相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<List<EduAssignmentVO>> getAssignmentList() {
        // 构建缓存键
        String cacheKey = "assignmentList";
        
        // 尝试从缓存获取
        Result<List<EduAssignmentVO>> cachedResult = (Result<List<EduAssignmentVO>>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取作业列表数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<List<EduAssignmentVO>> result = eduServiceFeignClient.getAssignmentList();
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存作业列表数据: key={}", cacheKey);
        }
        
        return result;
    }

    // =========================== 作业题目管理相关接口 ===========================

    @Override
    public Result<EduAssignmentQuestionVO> createAssignmentQuestion(EduAssignmentQuestionDTO dto) {
        Result<EduAssignmentQuestionVO> result = eduServiceFeignClient.createAssignmentQuestion(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除作业题目相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<EduAssignmentQuestionVO> getAssignmentQuestionById(Long id) {
        // 构建缓存键
        String cacheKey = "assignmentQuestionById:" + id;
        
        // 尝试从缓存获取
        Result<EduAssignmentQuestionVO> cachedResult = (Result<EduAssignmentQuestionVO>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取作业题目详情数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<EduAssignmentQuestionVO> result = eduServiceFeignClient.getAssignmentQuestionById(id);
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存作业题目详情数据: key={}", cacheKey);
        }
        
        return result;
    }

    @Override
    public Result<EduAssignmentQuestionVO> updateAssignmentQuestion(EduAssignmentQuestionDTO dto) {
        Result<EduAssignmentQuestionVO> result = eduServiceFeignClient.updateAssignmentQuestion(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除作业题目相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<Void> deleteAssignmentQuestion(Long id) {
        Result<Void> result = eduServiceFeignClient.deleteAssignmentQuestion(id);
        // 清除相关缓存
        if (result != null) {
            // 这里可以添加清除作业题目相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<List<EduAssignmentQuestionVO>> getAssignmentQuestionList() {
        // 构建缓存键
        String cacheKey = "assignmentQuestionList";
        
        // 尝试从缓存获取
        Result<List<EduAssignmentQuestionVO>> cachedResult = (Result<List<EduAssignmentQuestionVO>>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取作业题目列表数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<List<EduAssignmentQuestionVO>> result = eduServiceFeignClient.getAssignmentQuestionList();
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存作业题目列表数据: key={}", cacheKey);
        }
        
        return result;
    }

    // =========================== 作业提交管理相关接口 ===========================

    @Override
    public Result<EduAssignmentSubmissionVO> createAssignmentSubmission(EduAssignmentSubmissionDTO dto) {
        Result<EduAssignmentSubmissionVO> result = eduServiceFeignClient.createAssignmentSubmission(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除作业提交相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<EduAssignmentSubmissionVO> getAssignmentSubmissionById(Long id) {
        // 构建缓存键
        String cacheKey = "assignmentSubmissionById:" + id;
        
        // 尝试从缓存获取
        Result<EduAssignmentSubmissionVO> cachedResult = (Result<EduAssignmentSubmissionVO>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取作业提交详情数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<EduAssignmentSubmissionVO> result = eduServiceFeignClient.getAssignmentSubmissionById(id);
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存作业提交详情数据: key={}", cacheKey);
        }
        
        return result;
    }

    @Override
    public Result<EduAssignmentSubmissionVO> updateAssignmentSubmission(EduAssignmentSubmissionDTO dto) {
        Result<EduAssignmentSubmissionVO> result = eduServiceFeignClient.updateAssignmentSubmission(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除作业提交相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<Void> deleteAssignmentSubmission(Long id) {
        Result<Void> result = eduServiceFeignClient.deleteAssignmentSubmission(id);
        // 清除相关缓存
        if (result != null) {
            // 这里可以添加清除作业提交相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<List<EduAssignmentSubmissionVO>> getAssignmentSubmissionList() {
        // 构建缓存键
        String cacheKey = "assignmentSubmissionList";
        
        // 尝试从缓存获取
        Result<List<EduAssignmentSubmissionVO>> cachedResult = (Result<List<EduAssignmentSubmissionVO>>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取作业提交列表数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<List<EduAssignmentSubmissionVO>> result = eduServiceFeignClient.getAssignmentSubmissionList();
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存作业提交列表数据: key={}", cacheKey);
        }
        
        return result;
    }

    // =========================== 证书管理相关接口 ===========================

    @Override
    public Result<EduCertificateVO> createCertificate(EduCertificateDTO dto) {
        Result<EduCertificateVO> result = eduServiceFeignClient.createCertificate(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除证书相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<EduCertificateVO> getCertificateById(Long id) {
        // 构建缓存键
        String cacheKey = "certificateById:" + id;
        
        // 尝试从缓存获取
        Result<EduCertificateVO> cachedResult = (Result<EduCertificateVO>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取证书详情数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<EduCertificateVO> result = eduServiceFeignClient.getCertificateById(id);
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存证书详情数据: key={}", cacheKey);
        }
        
        return result;
    }

    @Override
    public Result<EduCertificateVO> updateCertificate(EduCertificateDTO dto) {
        Result<EduCertificateVO> result = eduServiceFeignClient.updateCertificate(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除证书相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<Void> deleteCertificate(Long id) {
        Result<Void> result = eduServiceFeignClient.deleteCertificate(id);
        // 清除相关缓存
        if (result != null) {
            // 这里可以添加清除证书相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<List<EduCertificateVO>> getCertificateList() {
        // 构建缓存键
        String cacheKey = "certificateList";
        
        // 尝试从缓存获取
        Result<List<EduCertificateVO>> cachedResult = (Result<List<EduCertificateVO>>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取证书列表数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<List<EduCertificateVO>> result = eduServiceFeignClient.getCertificateList();
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存证书列表数据: key={}", cacheKey);
        }
        
        return result;
    }

    // =========================== 章节管理相关接口 ===========================

    @Override
    public Result<EduChapterVO> createChapter(EduChapterDTO dto) {
        Result<EduChapterVO> result = eduServiceFeignClient.createChapter(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除章节相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<EduChapterVO> getChapterById(Long id) {
        // 构建缓存键
        String cacheKey = "chapterById:" + id;
        
        // 尝试从缓存获取
        Result<EduChapterVO> cachedResult = (Result<EduChapterVO>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取章节详情数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<EduChapterVO> result = eduServiceFeignClient.getChapterById(id);
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存章节详情数据: key={}", cacheKey);
        }
        
        return result;
    }

    @Override
    public Result<EduChapterVO> updateChapter(EduChapterDTO dto) {
        Result<EduChapterVO> result = eduServiceFeignClient.updateChapter(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除章节相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<Void> deleteChapter(Long id) {
        Result<Void> result = eduServiceFeignClient.deleteChapter(id);
        // 清除相关缓存
        if (result != null) {
            // 这里可以添加清除章节相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<List<EduChapterVO>> getChapterList() {
        // 构建缓存键
        String cacheKey = "chapterList";
        
        // 尝试从缓存获取
        Result<List<EduChapterVO>> cachedResult = (Result<List<EduChapterVO>>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取章节列表数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<List<EduChapterVO>> result = eduServiceFeignClient.getChapterList();
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存章节列表数据: key={}", cacheKey);
        }
        
        return result;
    }

    @Override
    public Result<List<EduChapterVO>> getChaptersByCourseId(Long courseId) {
        // 构建缓存键
        String cacheKey = "chaptersByCourseId:" + courseId;
        
        // 尝试从缓存获取
        Result<List<EduChapterVO>> cachedResult = (Result<List<EduChapterVO>>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取课程章节列表数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<List<EduChapterVO>> result = eduServiceFeignClient.getChaptersByCourseId(courseId);
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存课程章节列表数据: key={}", cacheKey);
        }
        
        return result;
    }

    // =========================== 签到管理相关接口 ===========================

    @Override
    public Result<EduCheckinVO> createCheckin(EduCheckinDTO dto) {
        Result<EduCheckinVO> result = eduServiceFeignClient.createCheckin(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除签到相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<EduCheckinVO> getCheckinById(Long id) {
        // 构建缓存键
        String cacheKey = "checkinById:" + id;
        
        // 尝试从缓存获取
        Result<EduCheckinVO> cachedResult = (Result<EduCheckinVO>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取签到详情数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<EduCheckinVO> result = eduServiceFeignClient.getCheckinById(id);
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存签到详情数据: key={}", cacheKey);
        }
        
        return result;
    }

    @Override
    public Result<EduCheckinVO> updateCheckin(EduCheckinDTO dto) {
        Result<EduCheckinVO> result = eduServiceFeignClient.updateCheckin(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除签到相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<Void> deleteCheckin(Long id) {
        Result<Void> result = eduServiceFeignClient.deleteCheckin(id);
        // 清除相关缓存
        if (result != null) {
            // 这里可以添加清除签到相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<List<EduCheckinVO>> getCheckinList() {
        // 构建缓存键
        String cacheKey = "checkinList";
        
        // 尝试从缓存获取
        Result<List<EduCheckinVO>> cachedResult = (Result<List<EduCheckinVO>>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取签到列表数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<List<EduCheckinVO>> result = eduServiceFeignClient.getCheckinList();
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存签到列表数据: key={}", cacheKey);
        }
        
        return result;
    }

    // =========================== 签到记录管理相关接口 ===========================

    @Override
    public Result<EduCheckinRecordVO> createCheckinRecord(EduCheckinRecordDTO dto) {
        Result<EduCheckinRecordVO> result = eduServiceFeignClient.createCheckinRecord(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除签到记录相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<EduCheckinRecordVO> getCheckinRecordById(Long id) {
        // 构建缓存键
        String cacheKey = "checkinRecordById:" + id;
        
        // 尝试从缓存获取
        Result<EduCheckinRecordVO> cachedResult = (Result<EduCheckinRecordVO>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取签到记录详情数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<EduCheckinRecordVO> result = eduServiceFeignClient.getCheckinRecordById(id);
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存签到记录详情数据: key={}", cacheKey);
        }
        
        return result;
    }

    @Override
    public Result<EduCheckinRecordVO> updateCheckinRecord(EduCheckinRecordDTO dto) {
        Result<EduCheckinRecordVO> result = eduServiceFeignClient.updateCheckinRecord(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除签到记录相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<Void> deleteCheckinRecord(Long id) {
        Result<Void> result = eduServiceFeignClient.deleteCheckinRecord(id);
        // 清除相关缓存
        if (result != null) {
            // 这里可以添加清除签到记录相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<List<EduCheckinRecordVO>> getCheckinRecordList() {
        // 构建缓存键
        String cacheKey = "checkinRecordList";
        
        // 尝试从缓存获取
        Result<List<EduCheckinRecordVO>> cachedResult = (Result<List<EduCheckinRecordVO>>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取签到记录列表数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<List<EduCheckinRecordVO>> result = eduServiceFeignClient.getCheckinRecordList();
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存签到记录列表数据: key={}", cacheKey);
        }
        
        return result;
    }

    // =========================== 课程班级关系管理相关接口 ===========================

    @Override
    public Result<EduCourseClassVO> createCourseClass(EduCourseClassDTO dto) {
        Result<EduCourseClassVO> result = eduServiceFeignClient.createCourseClass(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除课程班级关系相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<EduCourseClassVO> getCourseClassById(Long id) {
        // 构建缓存键
        String cacheKey = "courseClassById:" + id;
        
        // 尝试从缓存获取
        Result<EduCourseClassVO> cachedResult = (Result<EduCourseClassVO>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取课程班级关系详情数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<EduCourseClassVO> result = eduServiceFeignClient.getCourseClassById(id);
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存课程班级关系详情数据: key={}", cacheKey);
        }
        
        return result;
    }

    @Override
    public Result<EduCourseClassVO> updateCourseClass(EduCourseClassDTO dto) {
        Result<EduCourseClassVO> result = eduServiceFeignClient.updateCourseClass(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除课程班级关系相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<Void> deleteCourseClass(Long id) {
        Result<Void> result = eduServiceFeignClient.deleteCourseClass(id);
        // 清除相关缓存
        if (result != null) {
            // 这里可以添加清除课程班级关系相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<List<EduCourseClassVO>> getCourseClassList() {
        // 构建缓存键
        String cacheKey = "courseClassList";
        
        // 尝试从缓存获取
        Result<List<EduCourseClassVO>> cachedResult = (Result<List<EduCourseClassVO>>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取课程班级关系列表数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<List<EduCourseClassVO>> result = eduServiceFeignClient.getCourseClassList();
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存课程班级关系列表数据: key={}", cacheKey);
        }
        
        return result;
    }

    // =========================== 课程评价管理相关接口 ===========================

    @Override
    public Result<EduCourseRatingVO> createCourseRating(EduCourseRatingDTO dto) {
        Result<EduCourseRatingVO> result = eduServiceFeignClient.createCourseRating(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除课程评价相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<EduCourseRatingVO> getCourseRatingById(Long id) {
        // 构建缓存键
        String cacheKey = "courseRatingById:" + id;
        
        // 尝试从缓存获取
        Result<EduCourseRatingVO> cachedResult = (Result<EduCourseRatingVO>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取课程评价详情数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<EduCourseRatingVO> result = eduServiceFeignClient.getCourseRatingById(id);
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存课程评价详情数据: key={}", cacheKey);
        }
        
        return result;
    }

    @Override
    public Result<EduCourseRatingVO> updateCourseRating(EduCourseRatingDTO dto) {
        Result<EduCourseRatingVO> result = eduServiceFeignClient.updateCourseRating(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除课程评价相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<Void> deleteCourseRating(Long id) {
        Result<Void> result = eduServiceFeignClient.deleteCourseRating(id);
        // 清除相关缓存
        if (result != null) {
            // 这里可以添加清除课程评价相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<List<EduCourseRatingVO>> getCourseRatingList() {
        // 构建缓存键
        String cacheKey = "courseRatingList";
        
        // 尝试从缓存获取
        Result<List<EduCourseRatingVO>> cachedResult = (Result<List<EduCourseRatingVO>>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取课程评价列表数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<List<EduCourseRatingVO>> result = eduServiceFeignClient.getCourseRatingList();
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存课程评价列表数据: key={}", cacheKey);
        }
        
        return result;
    }

    // =========================== 课程选课管理相关接口 ===========================

    @Override
    public Result<EduCourseSelectionVO> createCourseSelection(EduCourseSelectionDTO dto) {
        Result<EduCourseSelectionVO> result = eduServiceFeignClient.createCourseSelection(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除课程选课相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<EduCourseSelectionVO> getCourseSelectionById(Long id) {
        // 构建缓存键
        String cacheKey = "courseSelectionById:" + id;
        
        // 尝试从缓存获取
        Result<EduCourseSelectionVO> cachedResult = (Result<EduCourseSelectionVO>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取课程选课详情数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<EduCourseSelectionVO> result = eduServiceFeignClient.getCourseSelectionById(id);
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存课程选课详情数据: key={}", cacheKey);
        }
        
        return result;
    }

    @Override
    public Result<EduCourseSelectionVO> updateCourseSelection(EduCourseSelectionDTO dto) {
        Result<EduCourseSelectionVO> result = eduServiceFeignClient.updateCourseSelection(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除课程选课相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<Void> deleteCourseSelection(Long id) {
        Result<Void> result = eduServiceFeignClient.deleteCourseSelection(id);
        // 清除相关缓存
        if (result != null) {
            // 这里可以添加清除课程选课相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<List<EduCourseSelectionVO>> getCourseSelectionList() {
        // 构建缓存键
        String cacheKey = "courseSelectionList";
        
        // 尝试从缓存获取
        Result<List<EduCourseSelectionVO>> cachedResult = (Result<List<EduCourseSelectionVO>>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取课程选课列表数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<List<EduCourseSelectionVO>> result = eduServiceFeignClient.getCourseSelectionList();
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存课程选课列表数据: key={}", cacheKey);
        }
        
        return result;
    }

    // =========================== 学分管理相关接口 ===========================

    @Override
    public Result<EduCreditVO> createCredit(EduCreditDTO dto) {
        Result<EduCreditVO> result = eduServiceFeignClient.createCredit(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除学分相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<EduCreditVO> getCreditById(Long id) {
        // 构建缓存键
        String cacheKey = "creditById:" + id;
        
        // 尝试从缓存获取
        Result<EduCreditVO> cachedResult = (Result<EduCreditVO>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取学分详情数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<EduCreditVO> result = eduServiceFeignClient.getCreditById(id);
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存学分详情数据: key={}", cacheKey);
        }
        
        return result;
    }

    @Override
    public Result<EduCreditVO> updateCredit(EduCreditDTO dto) {
        Result<EduCreditVO> result = eduServiceFeignClient.updateCredit(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除学分相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<Void> deleteCredit(Long id) {
        Result<Void> result = eduServiceFeignClient.deleteCredit(id);
        // 清除相关缓存
        if (result != null) {
            // 这里可以添加清除学分相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<List<EduCreditVO>> getCreditList() {
        // 构建缓存键
        String cacheKey = "creditList";
        
        // 尝试从缓存获取
        Result<List<EduCreditVO>> cachedResult = (Result<List<EduCreditVO>>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取学分列表数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<List<EduCreditVO>> result = eduServiceFeignClient.getCreditList();
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存学分列表数据: key={}", cacheKey);
        }
        
        return result;
    }

    // =========================== 院系管理相关接口 ===========================

    @Override
    public Result<EduDepartmentVO> createDepartment(EduDepartmentDTO dto) {
        Result<EduDepartmentVO> result = eduServiceFeignClient.createDepartment(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除院系相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<EduDepartmentVO> getDepartmentById(Long id) {
        // 构建缓存键
        String cacheKey = "departmentById:" + id;
        
        // 尝试从缓存获取
        Result<EduDepartmentVO> cachedResult = (Result<EduDepartmentVO>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取院系详情数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<EduDepartmentVO> result = eduServiceFeignClient.getDepartmentById(id);
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存院系详情数据: key={}", cacheKey);
        }
        
        return result;
    }

    @Override
    public Result<EduDepartmentVO> updateDepartment(EduDepartmentDTO dto) {
        Result<EduDepartmentVO> result = eduServiceFeignClient.updateDepartment(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除院系相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<Void> deleteDepartment(Long id) {
        Result<Void> result = eduServiceFeignClient.deleteDepartment(id);
        // 清除相关缓存
        if (result != null) {
            // 这里可以添加清除院系相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<List<EduDepartmentVO>> getDepartmentList() {
        // 构建缓存键
        String cacheKey = "departmentList";
        
        // 尝试从缓存获取
        Result<List<EduDepartmentVO>> cachedResult = (Result<List<EduDepartmentVO>>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取院系列表数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<List<EduDepartmentVO>> result = eduServiceFeignClient.getDepartmentList();
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存院系列表数据: key={}", cacheKey);
        }
        
        return result;
    }

    // =========================== 考试记录管理相关接口 ===========================

    @Override
    public Result<EduExamRecordVO> createExamRecord(EduExamRecordDTO dto) {
        Result<EduExamRecordVO> result = eduServiceFeignClient.createExamRecord(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除考试记录相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<EduExamRecordVO> getExamRecordById(Long id) {
        // 构建缓存键
        String cacheKey = "examRecordById:" + id;
        
        // 尝试从缓存获取
        Result<EduExamRecordVO> cachedResult = (Result<EduExamRecordVO>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取考试记录详情数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<EduExamRecordVO> result = eduServiceFeignClient.getExamRecordById(id);
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存考试记录详情数据: key={}", cacheKey);
        }
        
        return result;
    }

    @Override
    public Result<EduExamRecordVO> updateExamRecord(EduExamRecordDTO dto) {
        Result<EduExamRecordVO> result = eduServiceFeignClient.updateExamRecord(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除考试记录相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<Void> deleteExamRecord(Long id) {
        Result<Void> result = eduServiceFeignClient.deleteExamRecord(id);
        // 清除相关缓存
        if (result != null) {
            // 这里可以添加清除考试记录相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<List<EduExamRecordVO>> getExamRecordList() {
        // 构建缓存键
        String cacheKey = "examRecordList";
        
        // 尝试从缓存获取
        Result<List<EduExamRecordVO>> cachedResult = (Result<List<EduExamRecordVO>>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取考试记录列表数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<List<EduExamRecordVO>> result = eduServiceFeignClient.getExamRecordList();
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存考试记录列表数据: key={}", cacheKey);
        }
        
        return result;
    }

    // =========================== 论坛点赞管理相关接口 ===========================

    @Override
    public Result<EduForumLikeVO> createForumLike(EduForumLikeDTO dto) {
        Result<EduForumLikeVO> result = eduServiceFeignClient.createForumLike(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除论坛点赞相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<EduForumLikeVO> getForumLikeById(Long id) {
        // 构建缓存键
        String cacheKey = "forumLikeById:" + id;
        
        // 尝试从缓存获取
        Result<EduForumLikeVO> cachedResult = (Result<EduForumLikeVO>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取论坛点赞详情数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<EduForumLikeVO> result = eduServiceFeignClient.getForumLikeById(id);
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存论坛点赞详情数据: key={}", cacheKey);
        }
        
        return result;
    }

    @Override
    public Result<EduForumLikeVO> updateForumLike(EduForumLikeDTO dto) {
        Result<EduForumLikeVO> result = eduServiceFeignClient.updateForumLike(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除论坛点赞相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<Void> deleteForumLike(Long id) {
        Result<Void> result = eduServiceFeignClient.deleteForumLike(id);
        // 清除相关缓存
        if (result != null) {
            // 这里可以添加清除论坛点赞相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<List<EduForumLikeVO>> getForumLikeList() {
        // 构建缓存键
        String cacheKey = "forumLikeList";
        
        // 尝试从缓存获取
        Result<List<EduForumLikeVO>> cachedResult = (Result<List<EduForumLikeVO>>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取论坛点赞列表数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<List<EduForumLikeVO>> result = eduServiceFeignClient.getForumLikeList();
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存论坛点赞列表数据: key={}", cacheKey);
        }
        
        return result;
    }

    // =========================== 论坛回复管理相关接口 ===========================

    @Override
    public Result<EduForumReplyVO> createForumReply(EduForumReplyDTO dto) {
        Result<EduForumReplyVO> result = eduServiceFeignClient.createForumReply(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除论坛回复相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<EduForumReplyVO> getForumReplyById(Long id) {
        // 构建缓存键
        String cacheKey = "forumReplyById:" + id;
        
        // 尝试从缓存获取
        Result<EduForumReplyVO> cachedResult = (Result<EduForumReplyVO>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取论坛回复详情数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<EduForumReplyVO> result = eduServiceFeignClient.getForumReplyById(id);
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存论坛回复详情数据: key={}", cacheKey);
        }
        
        return result;
    }

    @Override
    public Result<EduForumReplyVO> updateForumReply(EduForumReplyDTO dto) {
        Result<EduForumReplyVO> result = eduServiceFeignClient.updateForumReply(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除论坛回复相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<Void> deleteForumReply(Long id) {
        Result<Void> result = eduServiceFeignClient.deleteForumReply(id);
        // 清除相关缓存
        if (result != null) {
            // 这里可以添加清除论坛回复相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<List<EduForumReplyVO>> getForumReplyList() {
        // 构建缓存键
        String cacheKey = "forumReplyList";
        
        // 尝试从缓存获取
        Result<List<EduForumReplyVO>> cachedResult = (Result<List<EduForumReplyVO>>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取论坛回复列表数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<List<EduForumReplyVO>> result = eduServiceFeignClient.getForumReplyList();
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存论坛回复列表数据: key={}", cacheKey);
        }
        
        return result;
    }

    // =========================== 论坛主题管理相关接口 ===========================

    @Override
    public Result<EduForumTopicVO> createForumTopic(EduForumTopicDTO dto) {
        Result<EduForumTopicVO> result = eduServiceFeignClient.createForumTopic(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除论坛主题相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<EduForumTopicVO> getForumTopicById(Long id) {
        // 构建缓存键
        String cacheKey = "forumTopicById:" + id;
        
        // 尝试从缓存获取
        Result<EduForumTopicVO> cachedResult = (Result<EduForumTopicVO>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取论坛主题详情数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<EduForumTopicVO> result = eduServiceFeignClient.getForumTopicById(id);
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存论坛主题详情数据: key={}", cacheKey);
        }
        
        return result;
    }

    @Override
    public Result<EduForumTopicVO> updateForumTopic(EduForumTopicDTO dto) {
        Result<EduForumTopicVO> result = eduServiceFeignClient.updateForumTopic(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除论坛主题相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<Void> deleteForumTopic(Long id) {
        Result<Void> result = eduServiceFeignClient.deleteForumTopic(id);
        // 清除相关缓存
        if (result != null) {
            // 这里可以添加清除论坛主题相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<List<EduForumTopicVO>> getForumTopicList() {
        // 构建缓存键
        String cacheKey = "forumTopicList";
        
        // 尝试从缓存获取
        Result<List<EduForumTopicVO>> cachedResult = (Result<List<EduForumTopicVO>>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取论坛主题列表数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<List<EduForumTopicVO>> result = eduServiceFeignClient.getForumTopicList();
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存论坛主题列表数据: key={}", cacheKey);
        }
        
        return result;
    }

    // =========================== 知识点管理相关接口 ===========================

    @Override
    public Result<EduKnowledgePointVO> createKnowledgePoint(EduKnowledgePointDTO dto) {
        Result<EduKnowledgePointVO> result = eduServiceFeignClient.createKnowledgePoint(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除知识点相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<EduKnowledgePointVO> getKnowledgePointById(Long id) {
        // 构建缓存键
        String cacheKey = "knowledgePointById:" + id;
        
        // 尝试从缓存获取
        Result<EduKnowledgePointVO> cachedResult = (Result<EduKnowledgePointVO>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取知识点详情数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<EduKnowledgePointVO> result = eduServiceFeignClient.getKnowledgePointById(id);
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存知识点详情数据: key={}", cacheKey);
        }
        
        return result;
    }

    @Override
    public Result<EduKnowledgePointVO> updateKnowledgePoint(EduKnowledgePointDTO dto) {
        Result<EduKnowledgePointVO> result = eduServiceFeignClient.updateKnowledgePoint(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除知识点相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<Void> deleteKnowledgePoint(Long id) {
        Result<Void> result = eduServiceFeignClient.deleteKnowledgePoint(id);
        // 清除相关缓存
        if (result != null) {
            // 这里可以添加清除知识点相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<List<EduKnowledgePointVO>> getKnowledgePointList() {
        // 构建缓存键
        String cacheKey = "knowledgePointList";
        
        // 尝试从缓存获取
        Result<List<EduKnowledgePointVO>> cachedResult = (Result<List<EduKnowledgePointVO>>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取知识点列表数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<List<EduKnowledgePointVO>> result = eduServiceFeignClient.getKnowledgePointList();
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存知识点列表数据: key={}", cacheKey);
        }
        
        return result;
    }

    // =========================== 直播课堂管理相关接口 ===========================

    @Override
    public Result<EduLiveSessionVO> createLiveSession(EduLiveSessionDTO dto) {
        Result<EduLiveSessionVO> result = eduServiceFeignClient.createLiveSession(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除直播课堂相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<EduLiveSessionVO> getLiveSessionById(Long id) {
        // 构建缓存键
        String cacheKey = "liveSessionById:" + id;
        
        // 尝试从缓存获取
        Result<EduLiveSessionVO> cachedResult = (Result<EduLiveSessionVO>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取直播课堂详情数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<EduLiveSessionVO> result = eduServiceFeignClient.getLiveSessionById(id);
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存直播课堂详情数据: key={}", cacheKey);
        }
        
        return result;
    }

    @Override
    public Result<EduLiveSessionVO> updateLiveSession(EduLiveSessionDTO dto) {
        Result<EduLiveSessionVO> result = eduServiceFeignClient.updateLiveSession(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除直播课堂相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<Void> deleteLiveSession(Long id) {
        Result<Void> result = eduServiceFeignClient.deleteLiveSession(id);
        // 清除相关缓存
        if (result != null) {
            // 这里可以添加清除直播课堂相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<List<EduLiveSessionVO>> getLiveSessionList() {
        // 构建缓存键
        String cacheKey = "liveSessionList";
        
        // 尝试从缓存获取
        Result<List<EduLiveSessionVO>> cachedResult = (Result<List<EduLiveSessionVO>>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取直播课堂列表数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<List<EduLiveSessionVO>> result = eduServiceFeignClient.getLiveSessionList();
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存直播课堂列表数据: key={}", cacheKey);
        }
        
        return result;
    }

    // =========================== 直播观看记录管理相关接口 ===========================

    @Override
    public Result<EduLiveWatchRecordVO> createLiveWatchRecord(EduLiveWatchRecordDTO dto) {
        Result<EduLiveWatchRecordVO> result = eduServiceFeignClient.createLiveWatchRecord(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除直播观看记录相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<EduLiveWatchRecordVO> getLiveWatchRecordById(Long id) {
        // 构建缓存键
        String cacheKey = "liveWatchRecordById:" + id;
        
        // 尝试从缓存获取
        Result<EduLiveWatchRecordVO> cachedResult = (Result<EduLiveWatchRecordVO>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取直播观看记录详情数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<EduLiveWatchRecordVO> result = eduServiceFeignClient.getLiveWatchRecordById(id);
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存直播观看记录详情数据: key={}", cacheKey);
        }
        
        return result;
    }

    @Override
    public Result<EduLiveWatchRecordVO> updateLiveWatchRecord(EduLiveWatchRecordDTO dto) {
        Result<EduLiveWatchRecordVO> result = eduServiceFeignClient.updateLiveWatchRecord(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除直播观看记录相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<Void> deleteLiveWatchRecord(Long id) {
        Result<Void> result = eduServiceFeignClient.deleteLiveWatchRecord(id);
        // 清除相关缓存
        if (result != null) {
            // 这里可以添加清除直播观看记录相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<List<EduLiveWatchRecordVO>> getLiveWatchRecordList() {
        // 构建缓存键
        String cacheKey = "liveWatchRecordList";
        
        // 尝试从缓存获取
        Result<List<EduLiveWatchRecordVO>> cachedResult = (Result<List<EduLiveWatchRecordVO>>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取直播观看记录列表数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<List<EduLiveWatchRecordVO>> result = eduServiceFeignClient.getLiveWatchRecordList();
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存直播观看记录列表数据: key={}", cacheKey);
        }
        
        return result;
    }

    // =========================== 专业管理相关接口 ===========================

    @Override
    public Result<EduMajorVO> createMajor(EduMajorDTO dto) {
        Result<EduMajorVO> result = eduServiceFeignClient.createMajor(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除专业相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<EduMajorVO> getMajorById(Long id) {
        // 构建缓存键
        String cacheKey = "majorById:" + id;
        
        // 尝试从缓存获取
        Result<EduMajorVO> cachedResult = (Result<EduMajorVO>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取专业详情数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<EduMajorVO> result = eduServiceFeignClient.getMajorById(id);
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存专业详情数据: key={}", cacheKey);
        }
        
        return result;
    }

    @Override
    public Result<EduMajorVO> updateMajor(EduMajorDTO dto) {
        Result<EduMajorVO> result = eduServiceFeignClient.updateMajor(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除专业相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<Void> deleteMajor(Long id) {
        Result<Void> result = eduServiceFeignClient.deleteMajor(id);
        // 清除相关缓存
        if (result != null) {
            // 这里可以添加清除专业相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<List<EduMajorVO>> getMajorList() {
        // 构建缓存键
        String cacheKey = "majorList";
        
        // 尝试从缓存获取
        Result<List<EduMajorVO>> cachedResult = (Result<List<EduMajorVO>>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取专业列表数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<List<EduMajorVO>> result = eduServiceFeignClient.getMajorList();
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存专业列表数据: key={}", cacheKey);
        }
        
        return result;
    }

    // =========================== 学习进度管理相关接口 ===========================

    @Override
    public Result<EduProgressVO> createProgress(EduProgressDTO dto) {
        Result<EduProgressVO> result = eduServiceFeignClient.createProgress(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除学习进度相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<EduProgressVO> getProgressById(Long id) {
        // 构建缓存键
        String cacheKey = "progressById:" + id;
        
        // 尝试从缓存获取
        Result<EduProgressVO> cachedResult = (Result<EduProgressVO>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取学习进度详情数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<EduProgressVO> result = eduServiceFeignClient.getProgressById(id);
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存学习进度详情数据: key={}", cacheKey);
        }
        
        return result;
    }

    @Override
    public Result<EduProgressVO> updateProgress(EduProgressDTO dto) {
        Result<EduProgressVO> result = eduServiceFeignClient.updateProgress(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除学习进度相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<Void> deleteProgress(Long id) {
        Result<Void> result = eduServiceFeignClient.deleteProgress(id);
        // 清除相关缓存
        if (result != null) {
            // 这里可以添加清除学习进度相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<List<EduProgressVO>> getProgressList() {
        // 构建缓存键
        String cacheKey = "progressList";
        
        // 尝试从缓存获取
        Result<List<EduProgressVO>> cachedResult = (Result<List<EduProgressVO>>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取学习进度列表数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<List<EduProgressVO>> result = eduServiceFeignClient.getProgressList();
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存学习进度列表数据: key={}", cacheKey);
        }
        
        return result;
    }

    // =========================== 题库管理相关接口 ===========================

    @Override
    public Result<EduQuestionBankVO> createQuestionBank(EduQuestionBankDTO dto) {
        Result<EduQuestionBankVO> result = eduServiceFeignClient.createQuestionBank(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除题库相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<EduQuestionBankVO> getQuestionBankById(Long id) {
        // 构建缓存键
        String cacheKey = "questionBankById:" + id;
        
        // 尝试从缓存获取
        Result<EduQuestionBankVO> cachedResult = (Result<EduQuestionBankVO>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取题库详情数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<EduQuestionBankVO> result = eduServiceFeignClient.getQuestionBankById(id);
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存题库详情数据: key={}", cacheKey);
        }
        
        return result;
    }

    @Override
    public Result<EduQuestionBankVO> updateQuestionBank(EduQuestionBankDTO dto) {
        Result<EduQuestionBankVO> result = eduServiceFeignClient.updateQuestionBank(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除题库相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<Void> deleteQuestionBank(Long id) {
        Result<Void> result = eduServiceFeignClient.deleteQuestionBank(id);
        // 清除相关缓存
        if (result != null) {
            // 这里可以添加清除题库相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<List<EduQuestionBankVO>> getQuestionBankList() {
        // 构建缓存键
        String cacheKey = "questionBankList";
        
        // 尝试从缓存获取
        Result<List<EduQuestionBankVO>> cachedResult = (Result<List<EduQuestionBankVO>>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取题库列表数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<List<EduQuestionBankVO>> result = eduServiceFeignClient.getQuestionBankList();
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存题库列表数据: key={}", cacheKey);
        }
        
        return result;
    }

    // =========================== 题目管理相关接口 ===========================

    @Override
    public Result<EduQuestionVO> createQuestion(EduQuestionDTO dto) {
        Result<EduQuestionVO> result = eduServiceFeignClient.createQuestion(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除题目相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<EduQuestionVO> getQuestionById(Long id) {
        // 构建缓存键
        String cacheKey = "questionById:" + id;
        
        // 尝试从缓存获取
        Result<EduQuestionVO> cachedResult = (Result<EduQuestionVO>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取题目详情数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<EduQuestionVO> result = eduServiceFeignClient.getQuestionById(id);
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存题目详情数据: key={}", cacheKey);
        }
        
        return result;
    }

    @Override
    public Result<EduQuestionVO> updateQuestion(EduQuestionDTO dto) {
        Result<EduQuestionVO> result = eduServiceFeignClient.updateQuestion(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除题目相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<Void> deleteQuestion(Long id) {
        Result<Void> result = eduServiceFeignClient.deleteQuestion(id);
        // 清除相关缓存
        if (result != null) {
            // 这里可以添加清除题目相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<List<EduQuestionVO>> getQuestionList() {
        // 构建缓存键
        String cacheKey = "questionList";
        
        // 尝试从缓存获取
        Result<List<EduQuestionVO>> cachedResult = (Result<List<EduQuestionVO>>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取题目列表数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<List<EduQuestionVO>> result = eduServiceFeignClient.getQuestionList();
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存题目列表数据: key={}", cacheKey);
        }
        
        return result;
    }

    // =========================== 课程评价点赞管理相关接口 ===========================

    @Override
    public Result<EduRatingLikeVO> createRatingLike(EduRatingLikeDTO dto) {
        Result<EduRatingLikeVO> result = eduServiceFeignClient.createRatingLike(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除课程评价点赞相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<EduRatingLikeVO> getRatingLikeById(Long id) {
        // 构建缓存键
        String cacheKey = "ratingLikeById:" + id;
        
        // 尝试从缓存获取
        Result<EduRatingLikeVO> cachedResult = (Result<EduRatingLikeVO>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取课程评价点赞详情数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<EduRatingLikeVO> result = eduServiceFeignClient.getRatingLikeById(id);
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存课程评价点赞详情数据: key={}", cacheKey);
        }
        
        return result;
    }

    @Override
    public Result<EduRatingLikeVO> updateRatingLike(EduRatingLikeDTO dto) {
        Result<EduRatingLikeVO> result = eduServiceFeignClient.updateRatingLike(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除课程评价点赞相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<Void> deleteRatingLike(Long id) {
        Result<Void> result = eduServiceFeignClient.deleteRatingLike(id);
        // 清除相关缓存
        if (result != null) {
            // 这里可以添加清除课程评价点赞相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<List<EduRatingLikeVO>> getRatingLikeList() {
        // 构建缓存键
        String cacheKey = "ratingLikeList";
        
        // 尝试从缓存获取
        Result<List<EduRatingLikeVO>> cachedResult = (Result<List<EduRatingLikeVO>>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取课程评价点赞列表数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<List<EduRatingLikeVO>> result = eduServiceFeignClient.getRatingLikeList();
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存课程评价点赞列表数据: key={}", cacheKey);
        }
        
        return result;
    }

    // =========================== 课程资源管理相关接口 ===========================

    @Override
    public Result<EduResourceVO> createResource(EduResourceDTO dto) {
        Result<EduResourceVO> result = eduServiceFeignClient.createResource(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除课程资源相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<EduResourceVO> getResourceById(Long id) {
        // 构建缓存键
        String cacheKey = "resourceById:" + id;
        
        // 尝试从缓存获取
        Result<EduResourceVO> cachedResult = (Result<EduResourceVO>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取课程资源详情数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<EduResourceVO> result = eduServiceFeignClient.getResourceById(id);
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存课程资源详情数据: key={}", cacheKey);
        }
        
        return result;
    }

    @Override
    public Result<EduResourceVO> updateResource(EduResourceDTO dto) {
        Result<EduResourceVO> result = eduServiceFeignClient.updateResource(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除课程资源相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<Void> deleteResource(Long id) {
        Result<Void> result = eduServiceFeignClient.deleteResource(id);
        // 清除相关缓存
        if (result != null) {
            // 这里可以添加清除课程资源相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<List<EduResourceVO>> getResourceList() {
        // 构建缓存键
        String cacheKey = "resourceList";
        
        // 尝试从缓存获取
        Result<List<EduResourceVO>> cachedResult = (Result<List<EduResourceVO>>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取课程资源列表数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<List<EduResourceVO>> result = eduServiceFeignClient.getResourceList();
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存课程资源列表数据: key={}", cacheKey);
        }
        
        return result;
    }

    // =========================== 学校管理相关接口 ===========================

    @Override
    public Result<EduSchoolVO> createSchool(EduSchoolDTO dto) {
        Result<EduSchoolVO> result = eduServiceFeignClient.createSchool(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除学校相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<EduSchoolVO> getSchoolById(Long id) {
        // 构建缓存键
        String cacheKey = "schoolById:" + id;
        
        // 尝试从缓存获取
        Result<EduSchoolVO> cachedResult = (Result<EduSchoolVO>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取学校详情数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<EduSchoolVO> result = eduServiceFeignClient.getSchoolById(id);
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存学校详情数据: key={}", cacheKey);
        }
        
        return result;
    }

    @Override
    public Result<EduSchoolVO> updateSchool(EduSchoolDTO dto) {
        Result<EduSchoolVO> result = eduServiceFeignClient.updateSchool(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除学校相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<Void> deleteSchool(Long id) {
        Result<Void> result = eduServiceFeignClient.deleteSchool(id);
        // 清除相关缓存
        if (result != null) {
            // 这里可以添加清除学校相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<List<EduSchoolVO>> getSchoolList() {
        // 构建缓存键
        String cacheKey = "schoolList";
        
        // 尝试从缓存获取
        Result<List<EduSchoolVO>> cachedResult = (Result<List<EduSchoolVO>>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取学校列表数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<List<EduSchoolVO>> result = eduServiceFeignClient.getSchoolList();
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存学校列表数据: key={}", cacheKey);
        }
        
        return result;
    }

    // =========================== 学生成绩管理相关接口 ===========================

    @Override
    public Result<EduStudentGradeVO> createStudentGrade(EduStudentGradeDTO dto) {
        Result<EduStudentGradeVO> result = eduServiceFeignClient.createStudentGrade(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除学生成绩相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<EduStudentGradeVO> getStudentGradeById(Long id) {
        // 构建缓存键
        String cacheKey = "studentGradeById:" + id;
        
        // 尝试从缓存获取
        Result<EduStudentGradeVO> cachedResult = (Result<EduStudentGradeVO>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取学生成绩详情数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<EduStudentGradeVO> result = eduServiceFeignClient.getStudentGradeById(id);
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存学生成绩详情数据: key={}", cacheKey);
        }
        
        return result;
    }

    @Override
    public Result<EduStudentGradeVO> updateStudentGrade(EduStudentGradeDTO dto) {
        Result<EduStudentGradeVO> result = eduServiceFeignClient.updateStudentGrade(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除学生成绩相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<Void> deleteStudentGrade(Long id) {
        Result<Void> result = eduServiceFeignClient.deleteStudentGrade(id);
        // 清除相关缓存
        if (result != null) {
            // 这里可以添加清除学生成绩相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<List<EduStudentGradeVO>> getStudentGradeList() {
        // 构建缓存键
        String cacheKey = "studentGradeList";
        
        // 尝试从缓存获取
        Result<List<EduStudentGradeVO>> cachedResult = (Result<List<EduStudentGradeVO>>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取学生成绩列表数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<List<EduStudentGradeVO>> result = eduServiceFeignClient.getStudentGradeList();
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存学生成绩列表数据: key={}", cacheKey);
        }
        
        return result;
    }

    // =========================== 预警日志管理相关接口 ===========================

    @Override
    public Result<EduWarningLogVO> createWarningLog(EduWarningLogDTO dto) {
        Result<EduWarningLogVO> result = eduServiceFeignClient.createWarningLog(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除预警日志相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<EduWarningLogVO> getWarningLogById(Long id) {
        // 构建缓存键
        String cacheKey = "warningLogById:" + id;
        
        // 尝试从缓存获取
        Result<EduWarningLogVO> cachedResult = (Result<EduWarningLogVO>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取预警日志详情数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<EduWarningLogVO> result = eduServiceFeignClient.getWarningLogById(id);
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存预警日志详情数据: key={}", cacheKey);
        }
        
        return result;
    }

    @Override
    public Result<EduWarningLogVO> updateWarningLog(EduWarningLogDTO dto) {
        Result<EduWarningLogVO> result = eduServiceFeignClient.updateWarningLog(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除预警日志相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<Void> deleteWarningLog(Long id) {
        Result<Void> result = eduServiceFeignClient.deleteWarningLog(id);
        // 清除相关缓存
        if (result != null) {
            // 这里可以添加清除预警日志相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<List<EduWarningLogVO>> getWarningLogList() {
        // 构建缓存键
        String cacheKey = "warningLogList";
        
        // 尝试从缓存获取
        Result<List<EduWarningLogVO>> cachedResult = (Result<List<EduWarningLogVO>>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取预警日志列表数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<List<EduWarningLogVO>> result = eduServiceFeignClient.getWarningLogList();
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存预警日志列表数据: key={}", cacheKey);
        }
        
        return result;
    }

    // =========================== 预警规则管理相关接口 ===========================

    @Override
    public Result<EduWarningRuleVO> createWarningRule(EduWarningRuleDTO dto) {
        Result<EduWarningRuleVO> result = eduServiceFeignClient.createWarningRule(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除预警规则相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<EduWarningRuleVO> getWarningRuleById(Long id) {
        // 构建缓存键
        String cacheKey = "warningRuleById:" + id;
        
        // 尝试从缓存获取
        Result<EduWarningRuleVO> cachedResult = (Result<EduWarningRuleVO>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取预警规则详情数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<EduWarningRuleVO> result = eduServiceFeignClient.getWarningRuleById(id);
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存预警规则详情数据: key={}", cacheKey);
        }
        
        return result;
    }

    @Override
    public Result<EduWarningRuleVO> updateWarningRule(EduWarningRuleDTO dto) {
        Result<EduWarningRuleVO> result = eduServiceFeignClient.updateWarningRule(dto);
        // 清除相关缓存
        if (result != null && result.getData() != null) {
            // 这里可以添加清除预警规则相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<Void> deleteWarningRule(Long id) {
        Result<Void> result = eduServiceFeignClient.deleteWarningRule(id);
        // 清除相关缓存
        if (result != null) {
            // 这里可以添加清除预警规则相关缓存的逻辑
        }
        return result;
    }

    @Override
    public Result<List<EduWarningRuleVO>> getWarningRuleList() {
        // 构建缓存键
        String cacheKey = "warningRuleList";
        
        // 尝试从缓存获取
        Result<List<EduWarningRuleVO>> cachedResult = (Result<List<EduWarningRuleVO>>) redisTemplate.opsForValue().get(cacheKey);
        if (cachedResult != null) {
            log.info("从缓存获取预警规则列表数据: key={}", cacheKey);
            return cachedResult;
        }
        
        // 调用Feign客户端获取数据
        Result<List<EduWarningRuleVO>> result = eduServiceFeignClient.getWarningRuleList();
        
        // 缓存结果
        if (result != null && result.getData() != null) {
            redisTemplate.opsForValue().set(cacheKey, result, RedisTtlConstant.DEFAULT_TTL, TimeUnit.SECONDS);
            log.info("缓存预警规则列表数据: key={}", cacheKey);
        }
        
        return result;
    }
    
    // =========================== 缓存清理方法 ===========================
    
    /**
     * 清除课程相关缓存
     */
    private void clearCourseCache() {
        redisTemplate.delete(RedisKeyConstant.COURSE_PAGE + "*");
        redisTemplate.delete(RedisKeyConstant.COURSE_DETAIL + "*");
        log.info("清除课程相关缓存");
    }
    
    /**
     * 清除班级相关缓存
     */
    private void clearClassCache() {
        redisTemplate.delete(RedisKeyConstant.CLASS_PAGE + "*");
        redisTemplate.delete(RedisKeyConstant.CLASS_DETAIL + "*");
        log.info("清除班级相关缓存");
    }
    
    /**
     * 清除学生相关缓存
     */
    private void clearStudentCache() {
        redisTemplate.delete(RedisKeyConstant.STUDENT_PAGE + "*");
        redisTemplate.delete(RedisKeyConstant.STUDENT_DETAIL + "*");
        log.info("清除学生相关缓存");
    }
}